<!--{template header}-->
<script language="javascript" type="text/javascript" src="../../js/command.js"></script>
<script language="javascript" type="text/javascript">	

jQuery(function(){	
	
	bopuruiObj.category = {

		init: function(){
					
			bopuruiObj.command.mtabletr();

		}
	}

	bopuruiObj.category.init();
	
	
});

	 
function setCookie(name, value, days) {
	var exp  = new Date();    //new Date("December 31, 9998");
	exp.setTime(exp.getTime() + days*24*60*60*1000);
	document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}

function getCookie(name) {
	var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
	if(arr != null) return unescape(arr[2]); return null;
}

function js_folding(obj, rowNum)
{
	var tr = obj.parentNode.parentNode;
	var tbl = tr.parentNode.parentNode;
	var img = tr.getElementsByTagName("IMG")[0];

	if (rowNum > 0)
	{
	  var src = img.src.substr(img.src.lastIndexOf('/') + 1);
	  var rowIndex = tr.rowIndex + 1;
	  if (src == "menu_plus.gif"){
		  
		var subLevel = parseInt(tr.getAttribute('level')) + 1;
		for(var i=0;i<rowNum; i++){
		  var row = tbl.rows[rowIndex+i];
		  var level = parseInt(row.getAttribute('level'));
		  if (level == subLevel) row.style.display="";
		}
		img.src = "../images/admin/menu_minus.gif";
	  }else{
		//fold
		for(var i=0;i<rowNum; i++){
		  var row = tbl.rows[rowIndex+i];
		  var child = parseInt(row.getAttribute('child'));
		  if (child > 0){
			row.getElementsByTagName("IMG")[0].src = "../images/admin/menu_plus.gif";
		  }
		  row.style.display="none";
		}
		img.src = "../images/admin/menu_plus.gif";
	  }
	}else{
	  img.src = "../images/admin/menu_minus.gif";
	}
}

</script>

<style type="text/css">
.table1 tr.cur td { background:#ECF6FA;}
.table1a td{background:#d1eef9; }

.iptxt{width:30px;}

.table1 { width: 100%; background:none}
.table1 tbody { padding-left: 20px; }
.table1 tr {border-bottom:1px dotted #CCC;  }
.table1 td { border-bottom: 1px dotted #CCC; text-align: left; height:22px; line-height:22px; }
.table1 th { border-bottom: 1px solid #CCC;  text-align: left; color: #1A5499; }
.table1 th a { text-decoration: none; color:#1A5499; }
.table1 th a:hover { text-decoration: underline; color: #FF6600; }
</style>

<div class="path">

<span>分类管理</span>
<span><a href="category-create.htm">添加分类</a></span>
[分类排序设置的越小，越排在前面]
</div>
<div class="content">
<div class="c1">
  <table class="table1" id="myDataGrid" cellspacing="0">
	<tr>
	  <th width="405" align="center" class="first-cell" readOnly=false columnName="cate_name" witdh="500"><div align="center">用户名</div></th>
	  <th width="280" readOnly=false columnName="sort_order" dataType="int"><div align="center">分类排序</div></th>
	  <th width="311" readOnly=true><div align="center">信息数量</div></th>
	  <th width="126"><div align="center">添加时间</div></th>
	  <th width="198"><div align="center">操作</div></th>
	</tr>
	<!--{loop $categorys $key $list}-->
	<tr id="" level="{$list[level]}" child="{$list[child]}" >
	  <td colspan="5" class="first-cell" ><img id="menu_$key" src="../images/admin/{if $list[child] != 0}menu_minus.gif{else}menu_minus.gif{/if}" style="padding-left:{$list[level]}em;cursor:pointer;" width="9" height="9" border="0" onclick="js_folding(this, {$list[child]})" /> <span style=" font-weight:bold">{$list[cateName]}</span></td>
	</tr>

	<!--{loop $list[listArr] $vlist}-->
	<tr id="" level="{$vlist[level]}" child="{$vlist[child]}" >
	  <td class="first-cell" ><img src="../images/admin/{if $vlist[child] != 0}menu_minus.gif{else}menu_minus.gif{/if}" style="padding-left:{$vlist[level]}em;cursor:pointer;" width="9" height="9" border="0" onclick="js_folding(this, {$vlist[child]})" /> <span style="">{$vlist[cateName]}</span></td>
	  <td><div align="center"><span>{$vlist[cateSort]}</span></div></td>
	  <td><div align="center"><!--{$vlist[productCount]}--></div></td>
	  <td><div align="center">{$vlist[createdTime]}</div></td>
	  <td><div align="center"><a href="category-update-$vlist[categoryId].htm">编辑</a>&nbsp;&nbsp;<a href="javascript:if(confirm('确定是否要删除吗?')){location.href='category-delete-$vlist[categoryId].htm';}">删除</a></div></td>
	</tr>
   <!--{/loop}-->
   
	<script language="javascript">
	//js_folding(document.getElementById('menu_{$key}'), {$list[child]});
	</script>
   <!--{/loop}-->
  </table>

</div>
</div>
<!--{template footer}-->
</div>
</body>
</html>